"use strict";
function dingdingTool(n) {
  n = n || { j: 54826 };
  var r = Uint8Array, o = Uint16Array, i = Uint32Array, a = new r([
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    1,
    1,
    1,
    1,
    2,
    2,
    2,
    2,
    3,
    3,
    3,
    3,
    4,
    4,
    4,
    4,
    5,
    5,
    5,
    5,
    0,
    0,
    0,
    0
  ]), s = new r([
    0,
    0,
    0,
    0,
    1,
    1,
    2,
    2,
    3,
    3,
    4,
    4,
    5,
    5,
    6,
    6,
    7,
    7,
    8,
    8,
    9,
    9,
    10,
    10,
    11,
    11,
    12,
    12,
    13,
    13,
    0,
    0
  ]), u = new r([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), c = function(e, t) {
    for (var n2 = new o(31), r2 = 0; r2 < 31; ++r2)
      n2[r2] = t += 1 << e[r2 - 1];
    var a2 = new i(n2[30]);
    for (r2 = 1; r2 < 30; ++r2)
      for (var s2 = n2[r2]; s2 < n2[r2 + 1]; ++s2)
        a2[s2] = s2 - n2[r2] << 5 | r2;
    return [n2, a2];
  }, l = c(a, 2), f = l[0], h = l[1];
  f[28] = 258, h[258] = 28;
  for (var d = c(s, 0), p = d[0], y = d[1], m = new o(32768), v = 0; v < 32768; ++v) {
    var g = (43690 & v) >>> 1 | (21845 & v) << 1;
    g = (61680 & (g = (52428 & g) >>> 2 | (13107 & g) << 2)) >>> 4 | (3855 & g) << 4, m[v] = ((65280 & g) >>> 8 | (255 & g) << 8) >>> 1;
  }
  var b = function(e, t, n2) {
    for (var r2 = e.length, i2 = 0, a2 = new o(t); i2 < r2; ++i2)
      e[i2] && ++a2[e[i2] - 1];
    var s2, u2 = new o(t);
    for (i2 = 0; i2 < t; ++i2)
      u2[i2] = u2[i2 - 1] + a2[i2 - 1] << 1;
    if (n2) {
      s2 = new o(1 << t);
      var c2 = 15 - t;
      for (i2 = 0; i2 < r2; ++i2)
        if (e[i2])
          for (var l2 = i2 << 4 | e[i2], f2 = t - e[i2], h2 = u2[e[i2] - 1]++ << f2, d2 = h2 | (1 << f2) - 1; h2 <= d2; ++h2)
            s2[m[h2] >>> c2] = l2;
    } else
      for (s2 = new o(r2), i2 = 0; i2 < r2; ++i2)
        e[i2] && (s2[i2] = m[u2[e[i2] - 1]++] >>> 15 - e[i2]);
    return s2;
  }, w = new r(288);
  for (v = 0; v < 144; ++v)
    w[v] = 8;
  for (v = 144; v < 256; ++v)
    w[v] = 9;
  for (v = 256; v < 280; ++v)
    w[v] = 7;
  for (v = 280; v < 288; ++v)
    w[v] = 8;
  var _ = new r(32);
  for (v = 0; v < 32; ++v)
    _[v] = 5;
  6728 != n.j ? b(w, 9, 0) : null;
  var k = 6728 != n.j ? b(w, 9, 1) : null;
  6728 != n.j ? b(_, 5, 0) : null;
  var A = 6728 != n.j ? b(_, 5, 1) : null, S = function(e) {
    for (var t = e[0], n2 = 1; n2 < e.length; ++n2)
      e[n2] > t && (t = e[n2]);
    return t;
  }, C = function(e, t, n2) {
    var r2 = t / 8 | 0;
    return (e[r2] | e[r2 + 1] << 8) >> (7 & t) & n2;
  }, P = function(e, t) {
    var n2 = t / 8 | 0;
    return (e[n2] | e[n2 + 1] << 8 | e[n2 + 2] << 16) >> (7 & t);
  }, O = function(e) {
    return (e + 7) / 8 | 0;
  }, B = function(e, t, n2) {
    (null == t || t < 0) && (t = 0), (null == n2 || n2 > e.length) && (n2 = e.length);
    var a2 = new (2 == e.BYTES_PER_ELEMENT ? o : 4 == e.BYTES_PER_ELEMENT ? i : r)(n2 - t);
    return a2.set(e.subarray(t, n2)), a2;
  }, j = [
    "unexpected EOF",
    "invalid block type",
    "invalid length/literal",
    "invalid distance",
    "stream finished",
    "no stream handler",
    ,
    "no callback",
    "invalid UTF-8 data",
    "extra field too long",
    "date not in range 1980-2099",
    "filename too long",
    "stream finishing",
    "invalid zip data"
  ], K = function(e, t, n2) {
    var r2 = new Error(t || j[e]);
    if (r2.code = e, Error.captureStackTrace && Error.captureStackTrace(r2, K), !n2)
      throw r2;
    return r2;
  }, T = function(e, t, n2) {
    var o2 = e.length;
    if (!o2 || n2 && n2.f && !n2.l)
      return t || new r(0);
    var i2 = !t || n2, c2 = !n2 || n2.i;
    n2 || (n2 = {}), t || (t = new r(3 * o2));
    var l2 = function(e2) {
      var n3 = t.length;
      if (e2 > n3) {
        var o3 = new r(Math.max(2 * n3, e2));
        o3.set(t), t = o3;
      }
    }, h2 = n2.f || 0, d2 = n2.p || 0, y2 = n2.b || 0, m2 = n2.l, v2 = n2.d, g2 = n2.m, w2 = n2.n, _2 = 8 * o2;
    do {
      if (!m2) {
        h2 = C(e, d2, 1);
        var E2 = C(e, d2 + 1, 3);
        if (d2 += 3, !E2) {
          var x2 = e[(q2 = O(d2) + 4) - 4] | e[q2 - 3] << 8, j2 = q2 + x2;
          if (j2 > o2) {
            c2 && K(0);
            break;
          }
          i2 && l2(y2 + x2), t.set(e.subarray(q2, j2), y2), n2.b = y2 += x2, n2.p = d2 = 8 * j2, n2.f = h2;
          continue;
        }
        if (1 == E2)
          m2 = k, v2 = A, g2 = 9, w2 = 5;
        else if (2 == E2) {
          var T2 = C(e, d2, 31) + 257, I2 = C(e, d2 + 10, 15) + 4, R2 = T2 + C(e, d2 + 5, 31) + 1;
          d2 += 14;
          for (var M2 = new r(R2), L2 = new r(19), D2 = 0; D2 < I2; ++D2)
            L2[u[D2]] = C(e, d2 + 3 * D2, 7);
          d2 += 3 * I2;
          var U2 = S(L2), N2 = (1 << U2) - 1, F2 = b(L2, U2, 1);
          for (D2 = 0; D2 < R2; ) {
            var q2, Z2 = F2[C(e, d2, N2)];
            if (d2 += 15 & Z2, (q2 = Z2 >>> 4) < 16)
              M2[D2++] = q2;
            else {
              var H2 = 0, z2 = 0;
              for (16 == q2 ? (z2 = 3 + C(e, d2, 3), d2 += 2, H2 = M2[D2 - 1]) : 17 == q2 ? (z2 = 3 + C(e, d2, 7), d2 += 3) : 18 == q2 && (z2 = 11 + C(e, d2, 127), d2 += 7); z2--; )
                M2[D2++] = H2;
            }
          }
          var W2 = M2.subarray(0, T2), V2 = M2.subarray(T2);
          g2 = S(W2), w2 = S(V2), m2 = b(W2, g2, 1), v2 = b(V2, w2, 1);
        } else
          K(1);
        if (d2 > _2) {
          c2 && K(0);
          break;
        }
      }
      i2 && l2(y2 + 131072);
      for (var G2 = (1 << g2) - 1, Y2 = (1 << w2) - 1, Q2 = d2; ; Q2 = d2) {
        var J2 = (H2 = m2[P(e, d2) & G2]) >>> 4;
        if ((d2 += 15 & H2) > _2) {
          c2 && K(0);
          break;
        }
        if (H2 || K(2), J2 < 256)
          t[y2++] = J2;
        else {
          if (256 == J2) {
            Q2 = d2, m2 = null;
            break;
          }
          var X2 = J2 - 254;
          if (J2 > 264) {
            var $2 = a[D2 = J2 - 257];
            X2 = C(e, d2, (1 << $2) - 1) + f[D2], d2 += $2;
          }
          var ee2 = v2[P(e, d2) & Y2], te2 = ee2 >>> 4;
          ee2 || K(3), d2 += 15 & ee2;
          V2 = p[te2];
          if (te2 > 3) {
            $2 = s[te2];
            V2 += P(e, d2) & (1 << $2) - 1, d2 += $2;
          }
          if (d2 > _2) {
            c2 && K(0);
            break;
          }
          i2 && l2(y2 + 131072);
          for (var ne2 = y2 + X2; y2 < ne2; y2 += 4)
            t[y2] = t[y2 - V2], t[y2 + 1] = t[y2 + 1 - V2], t[y2 + 2] = t[y2 + 2 - V2], t[y2 + 3] = t[y2 + 3 - V2];
          y2 = ne2;
        }
      }
      n2.l = m2, n2.p = Q2, n2.b = y2, n2.f = h2, m2 && (h2 = 1, n2.m = g2, n2.d = v2, n2.n = w2);
    } while (!h2);
    return y2 == t.length ? t : B(t, 0, y2);
  }, Z = new r(0);
  6728 != n.j ? function() {
    for (var e = new Int32Array(256), t = 0; t < 256; ++t) {
      for (var n2 = t, r2 = 9; --r2; )
        n2 = (1 & n2 && -306674912) ^ n2 >>> 1;
      e[t] = n2;
    }
    return e;
  }() : null;
  var Q = function(e) {
    31 == e[0] && 139 == e[1] && 8 == e[2] || K(6, "invalid gzip data");
    var t = e[3], n2 = 10;
    4 & t && (n2 += e[10] | 2 + (e[11] << 8));
    for (var r2 = (t >> 3 & 1) + (t >> 4 & 1); r2 > 0; r2 -= !e[n2++])
      ;
    return n2 + (2 & t);
  }, J = function(e) {
    var t = e.length;
    return (e[t - 4] | e[t - 3] << 8 | e[t - 2] << 16 | e[t - 1] << 24) >>> 0;
  }, $ = function(e) {
    (8 != (15 & e[0]) || e[0] >>> 4 > 7 || (e[0] << 8 | e[1]) % 31) && K(6, "invalid zlib data"), 32 & e[1] && K(6, "invalid zlib data: preset dictionaries not supported");
  };
  function ee(e, t) {
    return T(e, t);
  }
  function ne(e, t) {
    return T(e.subarray(Q(e), -8), t || new r(J(e)));
  }
  function re(e, t) {
    return T(($(e), e.subarray(2, -4)), t);
  }
  function oe(e, t) {
    return 31 == e[0] && 139 == e[1] && 8 == e[2] ? ne(e, t) : 8 != (15 & e[0]) || e[0] >> 4 > 7 || (e[0] << 8 | e[1]) % 31 ? ee(e, t) : re(e, t);
  }
  "undefined" != typeof TextEncoder && new TextEncoder();
  var ae = "undefined" != typeof TextDecoder && new TextDecoder();
  try {
    ae.decode(Z, {
      stream: true
    }), 1;
  } catch (ue) {
  }
  return {
    formatterData: oe
  };
}
module.exports = dingdingTool;
